package br.com.girlian.saudenow;


import br.com.girlian.saudenow.Testes.GeradorBatimentos;

import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphViewSeries;
import com.jjoe64.graphview.GraphViewSeries.GraphViewSeriesStyle;
import com.jjoe64.graphview.GraphViewStyle;
import com.jjoe64.graphview.GraphViewStyle.GridStyle;
import com.jjoe64.graphview.LineGraphView;
import com.jjoe64.graphview.GraphView.GraphViewData;
import com.jjoe64.graphview.GraphView.LegendAlign;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;


public class FragmentoGrafico extends Fragment{
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle icicle){
		GraphViewSeriesStyle stylePressao = new GraphViewSeriesStyle(Color.rgb(250, 20, 10), 3);
		GraphViewSeries serie = new GraphViewSeries("Zona de Risco", stylePressao,new GraphViewData[]{
				new GraphViewData(1, 3.0d), new GraphViewData(2, 3.0d), new GraphViewData(3, 3.0d),
				new GraphViewData(4, 3.0d), new GraphViewData(5, 3.0d), new GraphViewData(6, 3.0d),
				new GraphViewData(7, 3.0d), new GraphViewData(8, 3.0d)
			});
			GraphViewSeriesStyle style = new GraphViewSeriesStyle(Color.rgb(150, 90, 250), 1);
			GraphViewSeries serieV = new GraphViewSeries("Batimentos", style, new GraphViewData[]{
			});
			
			GraphView grafico = new LineGraphView(inflater.getContext(), "Grafico de batimentos");
			//GraphView grafico = (LineGraphView)getView().findViewById(R.id.grafico);
			grafico.addSeries(serieV);
			grafico.addSeries(serie);
			
			//linhas de codigo teste
			
			grafico.setShowLegend(true);
			grafico.setLegendAlign(LegendAlign.BOTTOM);
			grafico.setLegendWidth(300);
			
			grafico.setGravity(Gravity.CENTER);
			grafico.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			
			grafico.getGraphViewStyle().setGridColor(Color.GREEN);
			grafico.getGraphViewStyle().setHorizontalLabelsColor(Color.WHITE);
			grafico.getGraphViewStyle().setVerticalLabelsColor(Color.WHITE);
			grafico.getGraphViewStyle().setVerticalLabelsWidth(20);
			grafico.setBackgroundColor(Color.WHITE);
			return grafico;
	}
	
}